package com.jwell.panprovider.ui.adapter

import android.support.v7.widget.RecyclerView
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.jwell.panprovider.R
import kotlinx.android.synthetic.main.adapter_date_picker_layout.view.*

/**
 * Created by 76577 on 2018/4/2.
 * 时间选择适配器
 */
class DatePickerAdapter(list: List<String>) : RecyclerView.Adapter<DatePickerAdapter.ViewHolder>() {
    var list = list

    override fun getItemCount(): Int {
        return list.size
    }

    override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): ViewHolder {
        val view = LayoutInflater.from(parent?.context).inflate(R.layout.adapter_date_picker_layout, parent, false)
        return ViewHolder(view)
    }

    override fun onBindViewHolder(holder: ViewHolder, position: Int) {
        with(holder.itemView) {
            text.text = list[position]
        }
    }

    class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView)

}